var webpack = require('webpack');
var WebpackDevServer = require('webpack-dev-server');
var config = require('./webpack.config');
var path = require('path');

//代理服务器
// var proxy = [{
// 	path: '/*/*', //必须得有一个文件地址，如果顶层文件夹名字不同，则用/*代替
// 	target: 'http://cangdu.org',
// 	host: 'cangdu.org',
// 	secure: false
// }];
var server = new WebpackDevServer(webpack(config), {
	contentBase: path.join(__dirname, "/dist"),
	compress: true,
	host:"localhost",
	hot:true,
	inline:true,
	open:true,//打开浏览器
	openPage:'hello.html',
	watchContentBase: true,
	port: 9000
});

//将其他路由，全部返回index.html
// server.app.get('*', function(req, res) {
// 	res.sendFile(__dirname + '/index.html')
// });
server.listen(9001, function() {
	console.log('正常打开9001端口')
});